import logging

from config import URL

class TenderApi(object):
    def __init__(self, session):
        self.session = session

    def tender(self,amount_v,id_v=642,depositCertificate_v=-1):
        url = URL + "/trust/trust/tender"
        form_data = {'id':id_v,'depositCertificate':depositCertificate_v,'amount':amount_v}
        response = self.session.post(url=url,data=form_data)
        logging.info("投资接口获取的响应数据:{}".format(response.json()))
        return response

    def third_tender(self,url,form_data):
        response = self.session.post(url=url, data=form_data)
        logging.info("第三方投资接口获取的响应数据:{}".format(response.text))
        return response